import Vue from 'vue'
import Vuex from 'vuex'
import _store from 'store2'
import _ from 'lodash'
import user from './modules/user'
import common from './modules/common'
import getters from './getters'
Vue.use(Vuex)
const store = new Vuex.Store({
  mutations: {
    resetAllState (state, payload) {
      const _initState =JSON.parse( _store('initState')) // 取出初始值的缓存
      sessionStorage.clear();
      _.extend(state, _initState);
    }
  },
  modules: {
    user,
    common,
  },
  getters,
})
_store({ initState: JSON.stringify(store.state) })
export default store
